package com.ipworkbench.ipw.systemsettings.action;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ipworkbench.common.struts2.action.BaseAction;
import com.ipworkbench.common.util.IPWException;
import com.ipworkbench.ipw.systemsettings.entity.User;
import com.ipworkbench.ipw.systemsettings.manager.UserMgr;

@SuppressWarnings("serial")
public class UserAct extends BaseAction {

	
	
	
	
	private User getEntity() {

		User user = (User) getSession("");
		User entity = new User();
		entity.setLogin_account(loginAccount);
		entity.setFull_name(fullName);
		entity.setOffice_phone(officePhone);
		entity.setOffice_phone(mobilePhone);
		entity.setSex(sex);
		entity.setEmail(email);
		entity.setDept_id(deptId);
		entity.setLast_modify_time(new Date());
		entity.setLast_modify(user.getUser_id());

		return entity;

	}
    
public String showUserList()throws IPWException{
		
		try {
			List<Map<String, String>> list2 = new ArrayList<Map<String, String>>();
			Map<String, String> map=new HashMap<String,String>();
			
			Map<String, String> map2=new HashMap<String,String>();
			Map<String,Object> map3=new HashMap<String,Object>();
			
			map.put("id", "1");
			map.put("name", "张三");
			map.put("depart","市场部");
			map.put("createTime", "2012-05-21");
			map.put("updateTime", "2012-05-21");
			map.put("status", "有效");
			
			map2.put("id", "2");
			map2.put("name", "李四");
			map2.put("depart", "市场部");
			map2.put("createTime", "2012-05-21");
			map2.put("updateTime", "2012-05-21");
			map2.put("status", "有效");
			
			list2.add(map);
			list2.add(map2);
			list2.add(map2);
			list2.add(map2);
			list2.add(map2);
			list2.add(map2);
			list2.add(map2);
			list2.add(map2);
			list2.add(map2);
			list2.add(map2);
			list2.add(map2);
			list2.add(map2);
			list2.add(map2);
			jsonMap.put("total",list2.size());//total键 存放总记录数，必须的           列表
			jsonMap.put("rows",list2);//rows键 存放每页记录 list  
         
		} catch (Exception e) {
			e.printStackTrace();
			return ERROR;
		}

		return SUCCESS;	
	}
	
	private String loginAccount;
	private String loginPwd;
	private String fullName;
	private String officePhone;
	private String mobilePhone;
	private String email;
	private Integer sex;
	private Long deptId;

	private UserMgr mgr;

	public UserMgr getMgr() {
		if (null == mgr) {
			mgr = new UserMgr();
		}
		return mgr;
	}

	public String getLoginAccount() {
		return loginAccount;
	}

	public void setLoginAccount(String loginAccount) {
		this.loginAccount = loginAccount;
	}

	public String getLoginPwd() {
		return loginPwd;
	}

	public void setLoginPwd(String loginPwd) {
		this.loginPwd = loginPwd;
	}

	public String getFullName() {
		return fullName;
	}

	public void setFullName(String fullName) {
		this.fullName = fullName;
	}

	public String getOfficePhone() {
		return officePhone;
	}

	public void setOfficePhone(String officePhone) {
		this.officePhone = officePhone;
	}

	public String getMobilePhone() {
		return mobilePhone;
	}

	public void setMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Integer getSex() {
		return sex;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}

	public Long getDeptId() {
		return deptId;
	}

	public void setDeptId(Long deptId) {
		this.deptId = deptId;
	}

}
